AZ-204 Quiz

← Back to Topics

Cosmos DB (1 / 62):

Complete the following pre-trigger that adds timestampt to every new item:

function validateToDoItemTimestamp() {
  /* Code here */

  // item to be created in the current operation
  var itemToCreate = /* Code here */;

  // validate properties
  if (!("timestamp" in itemToCreate)) {
    var ts = new Date();
    itemToCreate["timestamp"] = ts.getTime();
  }

  // update the item that will be created
  /* Code here */
}
Exam revision: April 11, 2025